
Introduction
Environment Setup
What is JavaScript vs ES-5 or ES-6
JavaScript Syntax
JavaScript Comments
JavaScript Use Strict
JavaScript Variables
JavaScript Reserved Words
JavaScript Scope
JavaScript Data Types
JavaScript Function
Function overloading not possible in JavaScript
JavaScript Arrow Function
JavaScript Numbers
JavaScript Number Methods
JavaScript String
JavaScript String Methods
JavaScript if else and else if
JavaScript Comparison and Logical Operators
JavaScript Arrays
JavaScript Sorting Arrays
JavaScript Array Iteration Methods
JavaScript for loop
JavaScript Let keyword
JavaScript Const
JavaScript Objects
JavaScript Object Methods
JavaScript ES5 Object Methods
JavaScript Object Accessors
JavaScript Math Object
JavaScript Random
JavaScript this Keyword
JavaScript Date Objects and Date Formats
JavaScript Classes
JavaScript While Loop
JavaScript Break and Continue
JavaScript Switch Statement
JavaScript JSON
Error handling in JavaScript
In this part we will discuss the condition part in the JavaScript section. If else is the most popular to use condition check. When we compeer something and check the value and write the output base on checking then we use if else condition. Also, this if else condition we use our need. Now given bellow the example code and explain the code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
// JavaScript if else condition
// declire the variabole
var num1=10;
var num2=5;
var num3=10;
var num4=15;
// check the condition
if (num1==num3) {
console.log("Match the number one and number two!");
}
else if(num2==num4){
console.log("Match the number two and number fore!");
}
else{
console.log("dosent match!");
}
</script>
</body>
</html>
In this code we write four variable names as num1, num2, num3, num4 then we write the condition using if else and check the condition. Then print the value what we want to output.